<?php
    if (!isset($title))     $title  = 'Contact(s)';
    if (!isset($button))    $button = 'Click me I\'m famous';
    if (!isset($url))       $url    = '';
    echo form_fieldset($title);
    echo form_open($url);
    echo '<table id="table_contacts">';
    echo '<tr> <th>Name</th> <th>First Name</th> <th>Mail</th> </tr>';
    foreach ($contacts as $contact){
        echo '<tr>';

        echo '<td>';
        echo $contact['name'];
        echo '</td>';
        
        echo '<td>';
        echo $contact['firstName'];
        echo '</td>';

        echo '<td>';
        echo $contact['mail'];
        echo '</td>';

        echo '<td>';
        $checkAttributes = array(
            'name'  => 'check_contact[]',
            'value' => $contact['id']);
        echo form_checkbox($checkAttributes);
        echo '</td>';
        echo '</tr>';
    }
    echo '</table>';
    echo form_hidden('list',$listInfo);
    echo form_submit(null, $button);
    echo form_close();
    echo form_fieldset_close();
?>